//Color.cpp 
//Color Class
/*
Nathan Currier / Rideliner
	nathan.currier@gmail.com
	rideliner.uni.cc
ColorCoded
	http://code.google.com/p/colorcoded/
*/

#include <string>
#include <cstdio>
#include "Color.h"
using namespace std;

Color::Color(void) {} //declare constructor

void Color::split_hex(string _code)
{
	_hexa = _code.substr(0, 2);
	_hexb = _code.substr(2, 2);
	_hexc = _code.substr(4, 2);
}

Color::Color(string name, string code) //set constructor
{
	_name = name;
	_code = code;

	split_hex(_code);
}

Color::Color(const Color &from) //copy constructor
{
	_name = from._name;
	_code = from._code;

	split_hex(_code);
}

void Color::set(string name, string code) //set
{
	_name = name;
	_code = code;

	split_hex(_code);
}

void Color::get_back(string &name, string &code) //get both the name and code
{
	name = _name;
	code = _code;
}

void Color::get_split(string &hex1, string &hex2, string &hex3) //get the split up code
{
	hex1 = _hexa;
	hex2 = _hexb;
	hex3 = _hexc;
}

string Color::get_split()
{
	return (_hexa + ' ' + _hexb + ' ' + _hexc);
}

string Color::get_name(void) //get the name
{
	return _name;
}

string Color::get_code(void) //get the code
{
	return _code;
}	

Color::~Color(void) {} //destructor
